{% extends "mytest/base.html" %}



{% block modalform %}
    <form method="post" action="{% url 'mytest:add_list' %}">
        {% csrf_token %}
        {{ form.username }}
        <div class="form-group">
            <label for="exampleInputPassword1">标题</label>
            <input type="text" name="title" class="form-control" placeholder="请输入">
        </div>

        <div class="modal-footer">
            <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
            <button type="submit" class="btn btn-primary">确认</button>
        </div>

    </form>
{% endblock %}





{% block mainbody %}
<div>
    <div class="container">
        <div style="margin-bottom: 10px">
            <!-- 按钮触发模态框 -->
            <button class="btn btn-primary add-btn">
                添加
            </button>
        <!-- 表格 -->
        <div class="bs-example" data-example-id="panel-without-body-with-table">
            <div class="panel panel-default">
              <!-- Default panel contents -->
              <div class="panel-heading">
                  <span class="glyphicon glyphicon-th-list" aria-hidden="true"></span>
                  部门列表
              </div>

              <!-- Table -->
              <table class="table">
                <thead>
                  <tr>
                    <th>ID</th>
                    <th>部门</th>
                    <th>操作</th>
                  </tr>
                </thead>
                <tbody>
                  {% for obj in data.rows %}
                  <tr>
                    <td>{{ obj.id }}</td>
                    <td>{{ obj.title }}</td>
                    <td>
                        <a class="btn btn-primary btn-xs" href="/mytest/data/{{ obj.id }}/edit">编辑</a>
                        <a class="btn btn-danger btn-xs" href="/mytest/data/{{ obj.id }}/delete">删除</a>
{#                        <a class="btn btn-danger btn-xs" href="mytest/data_edit.html">删除</a>#}
                    </td>
                  </tr>
                  {% endfor %}
                </tbody>
              </table>
            </div>
          </div>
        </div>
    </div>
</div>
{% endblock %}





